package com.acme.task3;

import java.util.*;

public class Task3Arrays {
	public static void main(String[] args) {
		
		if(args.length < 1){
			return;
		}
		int n = 0;
		try {
			n = Integer.parseInt(args[0]);
		}
		catch(NumberFormatException ex) { throw ex; }
		
		String mes = "number %d multiple of three";
		for (int i = 1; i <= n; i++) {
			if(i % 3 == 0) {
				System.out.println(new Formatter().format(mes, i));
			}
			else {
				System.out.println(i);
			}
		}
		
		int[] arr = new int[n];
		for(int i = 0; i < arr.length; i++) {
			arr[i] = i;
		}
		avg(arr);
	}
	
	public static void avg(int[] arr) {
		int sum = 0;
		int length = arr.length;
		for(int i = 0; i <= length; i++){
			sum += i;
		}
		System.out.println("\n" + "average of array: " + (double)sum/length);
	}
}
